<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
if (!isset($_SESSION)) {
  session_start();
}
define("CCTRL", "gallery");
define("CCTRLNAME", "gallery");
define("TOKEN", "4ab837664a8e17b1bec62a758a68b7ac");
include APPPATH . 'libraries/defu.php';
class slider extends CI_Controller  {
        function __construct()
        {
            parent::__construct();
            $this->load->helper('url');
            $this->load->model('backend/gallery_model');
            $this->gallery_model=new gallery_model();
            $this->load->library('smarty3');
            $this->smarty=new CI_Smarty3();
            $this->smarty->error_reporting = E_ALL & ~E_NOTICE;
            if(!isset($_SESSION["ADP"][CCTRL]["display"]))$_SESSION["ADP"][CCTRL]["display"]=0;
        }
        function index(){
            $_id="AD41F1044CBB7668BA3764D259458259";
            if(!isset($_SESSION["ADP"]["USER"])){
                $this->smarty->display("backend/00_login"); 
                return;
            }
            if(!checkAuthority(CCTRLNAME)){
                $this->smarty
                        ->assign('_SESSION', $_SESSION)
                        ->display("backend/00_accessdenied");
                return;
            }
            $tmp=$this->gallery_model->get($_id);
            if(count($tmp)>0){
                $Data["OBJ"]=$tmp[0];
                $Data["oGalleryDetail"]=$this->gallery_model->getDetails($Data["OBJ"]->_id,$Data["OBJ"]->_amount);
            }
            $this->smarty
                    ->assign('_SESSION', $_SESSION)
                    ->assign("Data", $Data)
                    ->display("backend/".CCTRL."/slider");
        }
}
?>
